<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2020/4/20
  Time: 15:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript" src="/js/jquery-2.0.3.min.js"></script>
    <script>
        $(function () {
            $("#btn").click(function () {
                var name="包";
                alert(name);
                $.ajax({
                    url:"login7",
                    type:"post",
                    data:{name:name},
                    dataType:"json",
                    success:function (result) {
                        console.log(result);
                        alert(name);
                    }
                })
            })
        });
        $(function () {
            $("#btn2").click(function () {
                var name="li";
                $.ajax({
                    url:"login8",
                    type:"post",
                    data:JSON.stringify(name),
                    cache:false,
                    contentType:"application/json", //传输是json数据类型
                    dataType:"json",
                    success:function (result) {
                        console.log(result);
                    }
                })
            })
        })
    </script>
</head>
<body>
<!--怎样才能将返回的数据展示出来？-->
<fieldset>
    <label>登录页面</label>
    <form action="login8" method="post">
        <p>
            用户名称：<input type="text" name="name" />
        </p>
        <p>
            用户密码：<input type="password" name="user_pwd" />
        </p>
        <p>
            <input type="submit" value="登录"/>
        </p>
    </form>
</fieldset>
<a href="login/jack/男">点击</a>
<button id="btn">ajax</button>
<button id="btn2" value="提交">ajax2</button>
</body>
</html>
